package com.vic.Utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author: Vic Ly
 */
public class dateUtils {
    public static final String Y_M_D_H_M_S = "yyyy-MM-dd HH:mm:ss";
    public static final String Y_M_D = "yyyy-MM-dd";
    public static final String YMD = "yyyy/MM/dd";

    public static String format(Date date,String type){
        return new SimpleDateFormat(type).format(date);
    }

    public static Date parse(String date,String type){
        try {
            new SimpleDateFormat(type).parse(date);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}
